<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        let obj = {
            x: 0,
            y: 0
        }
        let handel = {
            set: function(target, key, value) {
                if (value < 0) {
                    return;
                }
                if (value > 100) {
                    return;
                }
                target[key] = value;
            },
            get: function(target, key) {
                return target[key]
            }
        }
        obj = new Proxy(obj, handel);
        obj.x = 45;
        obj.y = 23;
        console.log(obj.x, obj.y);
    </script>
</body>

</html>